package com.ram.controller;

import com.ram.pojo.AccommodationFee;
import com.ram.pojo.Result;
import com.ram.service.AccommodationFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/accommodation/fee")
public class AccommodationFeeController {
    @Autowired
    private AccommodationFeeService feeService;

    @GetMapping("/list")
    public Result list() {
        return Result.success(feeService.list());
    }

    @GetMapping("/{id}")
    public Result getById(@PathVariable Integer id) {
        return Result.success(feeService.getById(id));
    }

    @PostMapping
    public Result add(@RequestBody AccommodationFee fee) {
        feeService.add(fee);
        return Result.success();
    }

    @PutMapping
    public Result update(@RequestBody AccommodationFee fee) {
        feeService.update(fee);
        return Result.success();
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id) {
        feeService.deleteById(id);
        return Result.success();
    }
} 